<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>按厂商名查询</title>
<style type="text/css">
  body{
    width:1280px;
    margin:0 auto;
  }
  table {
  	border-collapse:collapse;
  	width:100%;
  }
  table tr th, table tr td {
    text-align:center;
  }
  .pageList{
    float:right;
    clear:both;
  }
  .pageList_foot{
    clear:both;
    margin-bottom:20px;
    text-align:center;
  }
  .factoryList{
    float:right;
    clear:both;
    width:100%;
  }
</style>
<script>
  function pre(){
    var pageNo = parseInt(document.getElementById("pageNo").value);
    if (pageNo > 1) {
      pageNo = pageNo - 1;
    }
    goPage(pageNo);
  }
  function next() {
    var pageNo = parseInt(document.getElementById("pageNo").value);
    var totalPage = parseInt(document.getElementById("totalPage").value);
    if (pageNo < totalPage) {
      pageNo = pageNo + 1;
    }
    goPage(pageNo);
  }
  function last() {
    var totalPage = parseInt(document.getElementById("totalPage").value);
    goPage(totalPage);
  }
  function goPage(pageNo) {
    var currentPage = parseInt(document.getElementById("pageNo").value);
    var totalPage = parseInt(document.getElementById("totalPage").value);
    if (currentPage == 1 && pageNo == 1) {
      alert("已在首页");
      return false;
    }
    if (currentPage == totalPage && pageNo == totalPage) {
      alert("已达最后一页");
      return false;
    }
    location.href="showAutoFactory.action?pageNo="+pageNo;
  }
</script>
</head>
<body>
	<div class="ab-head">
	<s:include value="/WEB-INF/page/car/common/head.jsp"></s:include>
	</div>
	<div class="pageList">
	共${totalRecordCount}条记录,当前是第${currentPage}页，共${totalPage}页
	<a href="javascript:void(0)" onclick="goPage(1)">首页</a>&nbsp;<a href="javascript:void(0)" onclick="pre()">上一页</a>&nbsp;<a href="javascript:void(0)" onclick="next()">下一页</a>&nbsp;<a href="javascript:void(0)" onclick="last()">最后一页</a>&nbsp;
	</div>
	<div class="factoryList">
		<table border="1" cellpadding="0" cellspacing="0">
			<thead>
				<tr>
					<th>来源网站</th>
					<th>厂商</th>
					<th>相关厂商信息</th>
				</tr>
			</thead>
			<tbody>
			<s:iterator value="#request.autoFactoryList" id="factory" status="st">
				<tr>
					<td><s:property value="hostName"/></td>
					<td><a href="<s:property value="more_series_link"/>" target="_blank"><s:property value="factory"/></a></td>
					<td>
						<div>
							<table border="1" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%">厂商</td>
									<td width="80%">价格</td>
								</tr>
								<s:iterator value="toplist.items" id="toplistItem">
								<tr>
									<td><a href="<s:property value="#toplistItem.link"/>" target="_blank"><s:property value="#toplistItem.series"/></a></td>
									<td><s:property value="#toplistItem.price"/></td>
								</tr>
								</s:iterator>
							</table>
						</div>
					</td>
				</tr>
			</s:iterator>
			</tbody>
		</table>
	</div>
	<div class="pageList_foot">
	共${totalRecordCount}条记录,当前是第${currentPage}页，共${totalPage}页
	<a href="javascript:void(0)" onclick="goPage(1)">首页</a>&nbsp;<a href="javascript:void(0)" onclick="pre()">上一页</a>&nbsp;<a href="javascript:void(0)" onclick="next()">下一页</a>&nbsp;<a href="javascript:void(0)" onclick="last()">最后一页</a>&nbsp;
	</div>
	<input type="hidden" name="pageSize" id="pageSize" value="${pagesize}"/>
	<input type="hidden" name="currentPage" id="currentPage" value="${currentPage}"/>
	<input type="hidden" name="pageNo" id="pageNo" value="${pageNo}"/>
	<input type="hidden" name="totalPage" id="totalPage" value="${totalPage}"/>
</body>
</html>